package mall.service;

import org.apache.ibatis.session.SqlSession;

import mall.mybatis.util.SessionUtil;
import mall.pojo.Admin;

public class AdminService {
	private String mapper = "mall.mapper.AdminMapper.";
	private String queryByNamePassword = "getAdminByNamePassword";

	public Admin getByNamePassword(Admin admin) {
		SqlSession session = null;
		Admin retAdmin = null;
		try {
			session = SessionUtil.getInstance().openSession();
			String statement = this.mapper + this.queryByNamePassword;
			retAdmin = session.selectOne(statement, admin);
			return retAdmin;
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(),e);
		} finally {
//			session.close();
		}
	}

	
}
